<template>
  <div>
    <ButtonBarRowComponent>
      <Button text="查询" ref="add_modify_btn" :click-function="submit"/>
    </ButtonBarRowComponent>
    <ToolBarComponent ref="queryForm">
      <InputComponent ref="modifyName_input" input-lable="修正名称" input-name="modifyName"/>
      <InputComponent ref="modifyCode_input" input-lable="修正代码" input-name="modifyCode"/>
      <SelectComboComponent ref="modifyGroup_input" input-lable="修正类型" input-name="modifyGroup" group-code="BM03003"/>
      <SelectComboComponent ref="modifyType_input" input-lable="修正计算模式" input-name="modifyType" group-code="BM03002"/>
    </ToolBarComponent>
    <GridComponent
        ref="ck3ModifyGrid"
        :auto-load="true"
        key-property-name="id"
        grid-name="ck3ModifyGrid"
        select-moduel="single"
        load-url="ck3/generator/queryDictForPage.do"
        max-height-prop="66%"
        :paging-moduel="true"
    >
      <GridColumnComponent width="320px" column-name="修正名称" index-name="modifyName"/>
      <GridColumnComponent width="300px" column-name="修正代码" index-name="modifyCode"/>
      <GridColumnComponent width="150px" column-name="修正类型" index-name="modifyGroup" :data-render="renderModifyGroupDictValue"/>
      <GridColumnComponent width="150px" column-name="修正计算模式" index-name="modifyType" :data-render="renderModifyTypeDictValue"/>
    </GridComponent>
    <DictGroupComponent ref="dict">
      <DictDefineComponent dict-group="BM03002"/>
      <DictDefineComponent dict-group="BM03003"/>
    </DictGroupComponent>
  </div>
</template>

<script>
import ToolBarComponent from "@/components/toolbar/ToolBarComponent";
import ButtonBarRowComponent from "@/components/button/ButtonBarRowComponent";
import Button from "@/components/button/ButtonComponent";
import InputComponent from "@/components/input/InputComponent";
import SelectComboComponent from "@/components/input/SelectComboComponent";
import GridColumnComponent from "@/components/grid/GridColumnComponent";
import GridComponent from "@/components/grid/GridComponent";
import DictGroupComponent from "@/components/dict/DictGroupComponent";
import DictDefineComponent from "@/components/dict/DictDefineComponent";
import {translateByDict} from "@/common-util";

export default {
  name: "Ck3ModifyManagePage",
  components: {
    DictDefineComponent,
    DictGroupComponent,
    SelectComboComponent, InputComponent, Button, ButtonBarRowComponent, ToolBarComponent, GridComponent, GridColumnComponent},
  methods:{
    submit(){
      this.$refs["ck3ModifyGrid"].addQueryParams(this.$refs["queryForm"].getSubmitParams());
      this.$refs["ck3ModifyGrid"].load();
    },
    renderModifyGroupDictValue(columnData){
      return translateByDict(columnData,this.$refs["dict"].getDictGroup("BM03003"));
    },
    renderModifyTypeDictValue(columnData){
      return translateByDict(columnData,this.$refs["dict"].getDictGroup("BM03002"));
    }
  }
}
</script>

<style scoped>

</style>